package com.example.myapplication.message;


import static androidx.databinding.DataBindingUtil.setContentView;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.myapplication.R;
import com.example.myapplication.base.BR;
import com.example.myapplication.base.BaseFragment;
import com.example.myapplication.databinding.MessageViewBinding;

import java.util.ArrayList;
import java.util.List;

public class MessageFragment extends BaseFragment<MessageViewBinding, MessageViewModel> {
    private RecyclerView recyclerView;//声明RecyclerView
    private MessageAdapter adapterDome;//声明适配器
    private Context context;
    private List<String> list;


//    @Nullable
//    @Override
//    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//        View view = inflater.inflate(R.layout.message_view, container, false);
//        context = getContext();
//
//        recyclerView =  view.findViewById(R.id.recycler_view);
//        //添加数据
//        list = new ArrayList<>();
//        for (int i=0;i<100;i++){
//            list.add("这是第"+i+"个测试");
//        }
//        adapterDome = new MessageAdapter(context,list);
//        LinearLayoutManager manager = new LinearLayoutManager(context);
//        manager.setOrientation(LinearLayoutManager.VERTICAL);
//        recyclerView.setLayoutManager(manager);
//        //创建适配器，并且设置
//        recyclerView.setAdapter(adapterDome);
//        return view;
//    }

    @Override
    public int initContentView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return R.layout.message_view;
    }

    @Override
    public int initVariableId() {
        return BR.MessageView;
    }
}

